import request from '@/utils/request'

const apiName = "admin/role"
export default {

  getPageList(roleQuery) {
    return request({
      url: `${apiName}/list`,
      method: 'post',
      data: roleQuery
    })
  },
  getAll() {
    return request({
      url: `${apiName}/get-all`,
      method: 'get'
    })
  },
  getById(id) {
    return request({
      url: `${apiName}/get/${id}`,
      method: 'get'
    })
  },

  save(role) {
    return request({
      url: `${apiName}/save`,
      method: 'post',
      data: role
    })
  },

  updateById(role) {
    return request({
      url: `${apiName}/update`,
      method: 'put',
      data: role
    })
  },
  updateStatus(id, status) {
    let role = {
      id: id,
      status: status
    };
    return request({
      url: `${apiName}/update-status`,
      method: 'put',
      data: role
    })
  },
  getAssign(userId) {
    return request({
      url: `${apiName}/get-role/${userId}`,
      method: 'get'
    })
  },
  removeById(id) {
    return request({
      url: `${apiName}/remove/${id}`,
      method: 'delete'
    })
  },
  removeRows(idList) {
    return request({
      url: `${apiName}/batchRemove`,
      method: 'delete',
      data: idList
    })
  }

}
